package com.boat.framework.common.util;

import java.util.Collection;
import java.util.Map;

import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
/**
 * 断言类工具
 * @author 周江
 *
 */
public class AssertUtils {
	/**
	 * 参数不能为空，如为空则抛出异常
	 * @param param
	 * @param message
	 */
	public static void notBlank(Object param, String message) {
		if (param == null) {
			throw new IllegalArgumentException(message);
		}

		if (param instanceof String && StrUtil.isBlank((String) param)) {
			throw new IllegalArgumentException(message);
		}

		if (param instanceof Collection && ((Collection) param).isEmpty()) {
			throw new IllegalArgumentException(message);
		}
		
		if (ArrayUtil.isEmpty(param)) {
			throw new IllegalArgumentException(message);
		}

		if (param instanceof Map && ((Map) param).isEmpty()) {
			throw new IllegalArgumentException(message);
		}
	}
}
